home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / dll_gen / winfox / filetd.wd_ / filetd.wd (.txt)
Encoding:
Visual Basic Form  |  1995-01-31  |  17.4 KB  |  552 lines

  1. VERSION 2.00
  2. Begin Form FileTD 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "File Time/Date Changer"
  6.    ClientHeight    =   5715
  7.    ClientLeft      =   1005
  8.    ClientTop       =   1305
  9.    ClientWidth     =   8235
  10.    ControlBox      =   0   'False
  11.    Height          =   6120
  12.    Left            =   945
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   5715
  17.    ScaleWidth      =   8235
  18.    Top             =   960
  19.    Width           =   8355
  20.    Begin CommandButton CmdDeselectAll 
  21.       BackColor       =   &H00C0C0C0&
  22.       Caption         =   "&Deselect All"
  23.       Height          =   375
  24.       Left            =   960
  25.       TabIndex        =   1
  26.       Top             =   5040
  27.       Width           =   1575
  28.    End
  29.    Begin CommandButton CmdSelectAll 
  30.       BackColor       =   &H00C0C0C0&
  31.       Caption         =   "&Select All"
  32.       Height          =   375
  33.       Left            =   960
  34.       TabIndex        =   0
  35.       Top             =   4680
  36.       Width           =   1575
  37.    End
  38.    Begin CommandButton ChgDateTime 
  39.       BackColor       =   &H00C0C0C0&
  40.       Caption         =   "CHANGE &Both"
  41.       Height          =   375
  42.       Left            =   5640
  43.       TabIndex        =   6
  44.       Top             =   4680
  45.       Width           =   1575
  46.    End
  47.    Begin CommandButton CmdNewTime 
  48.       BackColor       =   &H00C0C0C0&
  49.       Caption         =   "Select A T&ime"
  50.       Height          =   375
  51.       Left            =   4080
  52.       TabIndex        =   5
  53.       Top             =   5040
  54.       Width           =   1575
  55.    End
  56.    Begin CommandButton CmdNewDate 
  57.       BackColor       =   &H00C0C0C0&
  58.       Caption         =   "Select A D&ate"
  59.       Height          =   375
  60.       Left            =   2520
  61.       TabIndex        =   3
  62.       Top             =   5040
  63.       Width           =   1575
  64.    End
  65.    Begin CommandButton CmdChgTime 
  66.       BackColor       =   &H00C0C0C0&
  67.       Caption         =   "CHANGE &Time"
  68.       Height          =   375
  69.       Left            =   4080
  70.       TabIndex        =   4
  71.       Top             =   4680
  72.       Width           =   1575
  73.    End
  74.    Begin CommandButton CmdChgDate 
  75.       BackColor       =   &H00C0C0C0&
  76.       Caption         =   "CHANGE &Date"
  77.       Height          =   375
  78.       Left            =   2520
  79.       TabIndex        =   2
  80.       Top             =   4680
  81.       Width           =   1575
  82.    End
  83.    Begin TextBox Text1 
  84.       Height          =   285
  85.       Left            =   960
  86.       MaxLength       =   64
  87.       TabIndex        =   8
  88.       Text            =   "Text1"
  89.       Top             =   1080
  90.       Width           =   3015
  91.    End
  92.    Begin FileListBox File1 
  93.       Height          =   225
  94.       Hidden          =   -1  'True
  95.       Left            =   4920
  96.       System          =   -1  'True
  97.       TabIndex        =   12
  98.       Top             =   3720
  99.       Visible         =   0   'False
  100.       Width           =   1575
  101.    End
  102.    Begin DirListBox Dir1 
  103.       Height          =   1155
  104.       Left            =   4200
  105.       TabIndex        =   9
  106.       Top             =   240
  107.       Width           =   3015
  108.    End
  109.    Begin DriveListBox Drive1 
  110.       Height          =   315
  111.       Left            =   960
  112.       TabIndex        =   10
  113.       Top             =   240
  114.       Width           =   3015
  115.    End
  116.    Begin ListBox FileList 
  117.       FontBold        =   0   'False
  118.       FontItalic      =   0   'False
  119.       FontName        =   "Fixedsys"
  120.       FontSize        =   9
  121.       FontStrikethru  =   0   'False
  122.       FontUnderline   =   0   'False
  123.       Height          =   1605
  124.       Left            =   360
  125.       MultiSelect     =   1  'Simple
  126.       Sorted          =   -1  'True
  127.       TabIndex        =   11
  128.       Top             =   3000
  129.       Width           =   7515
  130.    End
  131.    Begin CommandButton CmdOkay 
  132.       BackColor       =   &H00C0C0C0&
  133.       Cancel          =   -1  'True
  134.       Caption         =   "O &K A Y"
  135.       Height          =   375
  136.       Left            =   5640
  137.       TabIndex        =   7
  138.       Top             =   5040
  139.       Width           =   1575
  140.    End
  141.    Begin Label Label2 
  142.       Alignment       =   2  'Center
  143.       BackStyle       =   0  'Transparent
  144.       Caption         =   "For multiple selections, click once on each item"
  145.       FontBold        =   0   'False
  146.       FontItalic      =   0   'False
  147.       FontName        =   "MS Sans Serif"
  148.       FontSize        =   8.25
  149.       FontStrikethru  =   0   'False
  150.       FontUnderline   =   0   'False
  151.       Height          =   255
  152.       Left            =   360
  153.       TabIndex        =   18
  154.       Top             =   2760
  155.       Width           =   7515
  156.    End
  157.    Begin Label LblFileCount 
  158.       Alignment       =   2  'Center
  159.       BackColor       =   &H00C0C0C0&
  160.       Caption         =   "Label2"
  161.       ForeColor       =   &H00800000&
  162.       Height          =   195
  163.       Left            =   2640
  164.       TabIndex        =   17
  165.       Top             =   1920
  166.       Width           =   2895
  167.    End
  168.    Begin Label LblTime 
  169.       Alignment       =   2  'Center
  170.       BackColor       =   &H00C0C0C0&
  171.       Caption         =   "Label3"
  172.       ForeColor       =   &H00000080&
  173.       Height          =   195
  174.       Left            =   4200
  175.       TabIndex        =   16
  176.       Top             =   2400
  177.       Width           =   3015
  178.    End
  179.    Begin Label LblDate 
  180.       Alignment       =   2  'Center
  181.       BackColor       =   &H00C0C0C0&
  182.       Caption         =   "Label3"
  183.       ForeColor       =   &H00000080&
  184.       Height          =   195
  185.       Left            =   960
  186.       TabIndex        =   15
  187.       Top             =   2400
  188.       Width           =   3015
  189.    End
  190.    Begin Label LblFullPath 
  191.       Alignment       =   2  'Center
  192.       BackColor       =   &H00C0C0C0&
  193.       Caption         =   "Label2"
  194.       Height          =   195
  195.       Left            =   960
  196.       TabIndex        =   14
  197.       Top             =   1560
  198.       Width           =   6255
  199.    End
  200.    Begin Label Label1 
  201.       BackStyle       =   0  'Transparent
  202.       Caption         =   "Search Specification:"
  203.       ForeColor       =   &H00800000&
  204.       Height          =   195
  205.       Left            =   960
  206.       TabIndex        =   13
  207.       Top             =   840
  208.       Width           =   3015
  209.    End
  210. 'file list box allow multiple selections
  211. Dim PathWord As String
  212. Dim FileSpec As String
  213. Sub ChgDateTime_Click ()
  214.     ChangeCount% = 0
  215.     Screen.MousePointer = 11
  216.     On Error GoTo BadDrive4
  217.     For i = 0 To FileList.ListCount - 1
  218.         If FileList.Selected(i) = True Then
  219.             ThisDir$ = CurDir$
  220.             pos% = InStr(FileList.List(i), Chr$(9))
  221.             ThisFile$ = Left$(FileList.List(i), pos% - 1)
  222.             ThisFile$ = BackSlashAdd(ThisDir$) + ThisFile$
  223.             ChgYear% = Val(TheYear)
  224.             ChgMonth% = Val(TheMonth)
  225.             ChgDate% = Val(TheDate)
  226.             x% = SetFileDate(ThisFile$, ChgYear%, ChgMonth%, ChgDate%)
  227.             If x% = False Then
  228.                 Screen.MousePointer = 0
  229.                 MsgBox ThisFile$, 16, "Can Not Change Time"
  230.                 End If
  231.             ChgHours% = Val(TheHours)
  232.             ChgMinutes% = Val(TheMinutes)
  233.             x% = SetFileTime(ThisFile$, ChgHours%, ChgMinutes%)
  234.             If x% = False Then
  235.                 Screen.MousePointer = 0
  236.                 MsgBox ThisFile$, 16, "Can Not Change Time"
  237.                 End If
  238.             ChangeCount% = ChangeCount% + 1
  239.             End If
  240.         Next i
  241.     Screen.MousePointer = 0
  242.     If ChangeCount% = 0 Then
  243.         MsgBox "No files selected to change!", 16, "File Change Error"
  244.         Exit Sub
  245.         Else
  246.         DoFileList
  247.         End If
  248.     Exit Sub
  249. BadDrive4:
  250.     Screen.MousePointer = 0
  251.     MsgBox "Can NOT access drive!", 16, "Drive Error"
  252.     Exit Sub
  253. End Sub
  254. Sub CmdChgDate_Click ()
  255.     ChangeCount% = 0
  256.     Screen.MousePointer = 11
  257.     On Error GoTo BadDrive
  258.     For i = 0 To FileList.ListCount - 1
  259.         If FileList.Selected(i) = True Then
  260.             ThisDir$ = CurDir$
  261.             pos% = InStr(FileList.List(i), Chr$(9))
  262.             ThisFile$ = Left$(FileList.List(i), pos% - 1)
  263.             ThisFile$ = BackSlashAdd(ThisDir$) + ThisFile$
  264.             ChgYear% = Val(TheYear)
  265.             ChgMonth% = Val(TheMonth)
  266.             ChgDate% = Val(TheDate)
  267.             x% = SetFileDate(ThisFile$, ChgYear%, ChgMonth%, ChgDate%)
  268.             If x% = False Then
  269.                 Screen.MousePointer = 0
  270.                 MsgBox ThisFile$, 16, "Can Not Change Time"
  271.                 End If
  272.             ChangeCount% = ChangeCount% + 1
  273.             End If
  274.         Next i
  275.     Screen.MousePointer = 0
  276.     If ChangeCount% = 0 Then
  277.         MsgBox "No files selected to change!", 16, "File Change Error"
  278.         Exit Sub
  279.         Else
  280.         DoFileList
  281.         End If
  282.     Exit Sub
  283. BadDrive:
  284.     Screen.MousePointer = 0
  285.     MsgBox "Can NOT access drive!", 16, "Drive Error"
  286.     Exit Sub
  287. End Sub
  288. Sub CmdChgTime_Click ()
  289.     Screen.MousePointer = 11
  290.     ChangeCount% = 0
  291.     On Error GoTo BadDrive2
  292.     For i = 0 To FileList.ListCount - 1
  293.         If FileList.Selected(i) = True Then
  294.             ThisDir$ = CurDir$
  295.             pos% = InStr(FileList.List(i), Chr$(9))
  296.             ThisFile$ = Left$(FileList.List(i), pos% - 1)
  297.             ThisFile$ = BackSlashAdd(ThisDir$) + ThisFile$
  298.             ChgHours% = Val(TheHours)
  299.             ChgMinutes% = Val(TheMinutes)
  300.             x% = SetFileTime(ThisFile$, ChgHours%, ChgMinutes%)
  301.             If x% = False Then
  302.                 Screen.MousePointer = 0
  303.                 MsgBox ThisFile$, 16, "Can Not Change Time"
  304.                 End If
  305.             ChangeCount% = ChangeCount% + 1
  306.             End If
  307.         Next i
  308.     Screen.MousePointer = 0
  309.     If ChangeCount% = 0 Then
  310.         MsgBox "No files selected to change!", 16, "File Change Error"
  311.         Exit Sub
  312.         Else
  313.         DoFileList
  314.         End If
  315. Exit Sub
  316. BadDrive2:
  317.     Screen.MousePointer = 0
  318.     MsgBox "Can NOT access drive!", 16, "Drive Error"
  319.     Exit Sub
  320. End Sub
  321. Sub CmdDeselectAll_Click ()
  322.     Screen.MousePointer = 11
  323.     For i = 0 To FileList.ListCount - 1
  324.         FileList.Selected(i) = False
  325.         Next i
  326.     Screen.MousePointer = 0
  327. End Sub
  328. Sub CmdNewDate_Click ()
  329.     Screen.MousePointer = 11
  330.     CalSel.Show 1
  331.     Header = DateSerial(Val(TheYear), Val(TheMonth), Val(TheDate))
  332.     TheDateWord = Format$(Header, "d mmm yyyy")
  333.     LblDate.Caption = "Date to set:  " + TheDateWord
  334. End Sub
  335. Sub CmdNewTime_Click ()
  336. Dim TempHours As Integer
  337. Dim TempMinutes As Integer
  338. Dim TempMeridiem As Integer
  339.     Screen.MousePointer = 11
  340.     TimeChg.Show 1
  341.     TempHours = Val(TheHours)
  342.     If TempHours > 11 Then
  343.         TempHours = TempHours - 12
  344.         TempMeridiem = 1
  345.         Else
  346.         TempMeridiem = 0
  347.         End If
  348.     If TempHours = 0 Then TempHours = 12
  349.     TempMinutes = Val(TheMinutes)
  350.     TheTimeWord = Format$(TempHours, "##") + ":" + Format$(TempMinutes, "00")
  351.     If TempMeridiem = 1 Then
  352.         TheTimeWord = TheTimeWord + " pm"
  353.         Else
  354.         TheTimeWord = TheTimeWord + " am"
  355.         End If
  356.     LblTime.Caption = "Time to set:  " + TheTimeWord
  357. End Sub
  358. Sub CmdOkay_Click ()
  359.     Unload Me
  360. End Sub
  361. Sub CmdSelectAll_Click ()
  362.     Screen.MousePointer = 11
  363.     For i = 0 To FileList.ListCount - 1
  364.         FileList.Selected(i) = True
  365.         Next i
  366.     Screen.MousePointer = 0
  367. End Sub
  368. Sub Dir1_Change ()
  369.     Screen.MousePointer = 11
  370.     ChDir Dir1.Path
  371.     LblFullPath.Caption = PathWord + LCase$(Dir1.Path)
  372.     File1.Path = Dir1.Path
  373.     DoFileList
  374.     Screen.MousePointer = 0
  375. End Sub
  376. Sub DoFileList ()
  377.     Screen.MousePointer = 11
  378.     On Error GoTo BadFileSpec
  379.     File1.Pattern = FileSpec
  380.     FileList.Clear
  381.     NbrFound% = File1.ListCount
  382.     If NbrFound% = 0 Then
  383.         FileWord$ = "No Matching Files Found"
  384.         ElseIf NbrFound% = 1 Then FileWord$ = "One Matching File Found"
  385.         Else
  386.         FileWord$ = Format$(NbrFound%, "###,##0") + " Matching Files Found"
  387.         End If
  388.     LblFileCount.Caption = FileWord$
  389.     If File1.ListCount = 0 Then
  390.         CmdChgDate.Enabled = False
  391.         CmdChgTime.Enabled = False
  392.         CmdSelectAll.Enabled = False
  393.         CmdDeselectAll.Enabled = False
  394.         ChgDateTime.Enabled = False
  395.         Screen.MousePointer = 0
  396.         Exit Sub
  397.         Else
  398.         CmdChgDate.Enabled = True
  399.         CmdChgTime.Enabled = True
  400.         CmdSelectAll.Enabled = True
  401.         CmdDeselectAll.Enabled = True
  402.         ChgDateTime.Enabled = True
  403.         For i = 0 To File1.ListCount - 1
  404.             TheFileName$ = File1.List(i)
  405.             FullPath$ = CurDir$
  406.             FullPath$ = BackSlashAdd(FullPath$) + TheFileName$
  407.             TimeStamp$ = FileDateTime(FullPath$)
  408.             TheFileDate$ = Format$(TimeStamp$, "dd mmm yyyy")
  409.             If Left$(TheFileDate$, 1) = "0" Then
  410.                 TheFileDate$ = " " + Right$(TheFileDate$, Len(TheFileDate$) - 1)
  411.                 End If
  412.             TheFileTime$ = Format$(TimeStamp$, "hh:mm am/pm")
  413.             If Left$(TheFileTime$, 1) = "0" Then
  414.                 TheFileTime$ = " " + Right$(TheFileTime$, Len(TheFileTime$) - 1)
  415.                 End If
  416.             TheFileSize$ = Format$(FileLen(FullPath$), "###,###,##0")
  417.             If Len(TheFileSize$) < 11 Then
  418.                 AddSpace$ = Space$(11 - Len(TheFileSize$))
  419.                 Else
  420.                 AddSpace$ = ""
  421.                 End If
  422.             TheFileSize$ = AddSpace$ + TheFileSize$
  423.             TheFileAttr% = GetAttr(FullPath$)
  424.             TheAttr$ = ""
  425.             If (TheFileAttr% And 32) <> 0 Then
  426.                 TheAttr$ = TheAttr$ + "A"
  427.                 Else
  428.                 TheAttr$ = TheAttr$ + "-"
  429.                 End If
  430.             If (TheFileAttr% And 4) <> 0 Then
  431.                 TheAttr$ = TheAttr$ + "S"
  432.                 Else
  433.                 TheAttr$ = TheAttr$ + "-"
  434.                 End If
  435.             If (TheFileAttr% And 2) <> 0 Then
  436.                 TheAttr$ = TheAttr$ + "H"
  437.                 Else
  438.                 TheAttr$ = TheAttr$ + "-"
  439.                 End If
  440.             If (TheFileAttr% And 1) <> 0 Then
  441.                 TheAttr$ = TheAttr$ + "R"
  442.                 Else
  443.                 TheAttr$ = TheAttr$ + "-"
  444.                 End If
  445.             FileList.AddItem TheFileName$ + Chr$(9) + TheFileDate$ + Chr$(9) + TheFileTime$ + Chr$(9) + TheAttr$ + Chr$(9) + TheFileSize$
  446.             Next i
  447.         End If
  448.     Screen.MousePointer = 0
  449.     Exit Sub
  450. BadFileSpec:
  451.     Screen.MousePointer = 0
  452.     Beep
  453.     MsgBox "Invalid File Specification!", 16, "Data Entry Error"
  454.     Text1.SetFocus
  455.     Exit Sub
  456. End Sub
  457. Sub Drive1_Change ()
  458.     On Error GoTo SelDrvBad
  459.     Screen.MousePointer = 11
  460.     ChDrive Drive1.Drive
  461.     Dir1.Path = Drive1.Drive
  462.     Screen.MousePointer = 0
  463.     Exit Sub
  464. SelDrvBad:
  465.     Screen.MousePointer = 0
  466.     msg$ = "Drive Error " + UCase$(Left$(Drive1.Drive, 1)) + ":"
  467.     response = MsgBox("Can NOT Access Drive!", 21, msg$)
  468.     If response = 4 Then
  469.         Screen.MousePointer = 11
  470.         Resume 0
  471.         End If
  472.     WinRoot
  473.     Exit Sub
  474. End Sub
  475. Sub Form_Load ()
  476.     FormCenterScreen Me
  477.     PathWord = "Full Path = "
  478.     TheDateWord = Format$(Now, "d mmm yyyy")
  479.     TheMonth = Format$(Now, "m")
  480.     TheDate = Format$(Now, "d")
  481.     TheYear = Format$(Now, "yyyy")
  482.     LblDate.Caption = "Date to set:  " + TheDateWord
  483.     TheTimeWord = Format$(Now, "h:mm am/pm")
  484.     TheHours = Format$(Now, "h")
  485.     TheMinutes = Format$(Now, "n")
  486.     LblTime.Caption = "Time to set:  " + TheTimeWord
  487.     On Error GoTo BadDrive3
  488.     LblFullPath.Caption = PathWord + LCase$(CurDir$)
  489.     ListHscroll FileList, 40
  490.     ReDim tabsets%(4)
  491.     tabsets%(0) = 0
  492.     tabsets%(1) = 16 * 4
  493.     tabsets%(2) = 30 * 4
  494.     tabsets%(3) = 42 * 4
  495.     tabsets%(4) = 44 * 4
  496.     dummy% = OutMessage(FileList.hWnd, 1043, 5, tabsets%(0))
  497.     FileSpec = "*.*"
  498.     Text1.Text = FileSpec
  499.     DoFileList
  500.     Screen.MousePointer = 0
  501.     Exit Sub
  502. BadDrive3:
  503.     WinRoot
  504.     Resume Next
  505. End Sub
  506. Sub Form_Paint ()
  507.     DoForm3D Me, "raised", 2, 0
  508.     DoForm3D Me, "sunken", 2, 2
  509.     DoControl3D Drive1, "sunken", 1
  510.     DoControl3D Dir1, "sunken", 1
  511.     DoControl3D Text1, "sunken", 1
  512.     DoControl3D FileList, "sunken", 2
  513.     DoControl3D LblFullPath, "sunken", 1
  514.     DoControl3D LblFileCount, "sunken", 1
  515.     DoControl3D LblDate, "sunken", 1
  516.     DoControl3D LblTime, "sunken", 1
  517. End Sub
  518. Sub Text1_GotFocus ()
  519.     Text1.SelStart = 0
  520.     Text1.SelLength = Len(Text1.Text)
  521. End Sub
  522. Sub Text1_KeyPress (KeyAscii As Integer)
  523.     char = Chr(KeyAscii)
  524.     KeyAscii = Asc(UCase(char))
  525.     If char = "\" Then KeyAscii = 0
  526.     If char = Chr$(34) Then KeyAscii = 0
  527.     If char = Chr$(32) Then KeyAscii = 0
  528.     If char = ":" Then KeyAscii = 0
  529.     If char = Chr$(13) Then
  530.         KeyAscii = 0
  531.         SendKeys "{TAB}"
  532.         Exit Sub
  533.         End If
  534. End Sub
  535. Sub Text1_LostFocus ()
  536.     FileSpec = Text1.Text
  537.     DoFileList
  538. End Sub
  539. Sub WinRoot ()
  540.     Screen.MousePointer = 11
  541.     ReturnString$ = Space$(255)
  542.     ChDrive "c:"
  543.     ret% = GetPath("Windows", ReturnString$)
  544.     WinDir$ = TrimAtNull(ReturnString$)
  545.     WinDir$ = Left$(WinDir$, 3)
  546.     Drive1.Drive = WinDir$
  547.     ChDrive WinDir$
  548.     Dir1.Path = CurDir$
  549.     LblFullPath.Caption = PathWord + LCase$(Dir1.Path)
  550.     Screen.MousePointer = 0
  551. End Sub
  552.